# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php8-pecl-ev
_extname=ev
pkgver=1.1.6_rc1
_pkgver=${pkgver/_rc/RC}
pkgrel=0
pkgdesc="PHP 8.0 PECL interface to libev library - high performance full-featured event loop written in C."
url="https://pecl.php.net/package/ev"
arch="all"
license="PHP-3.01"
depends="php8-sockets"
makedepends="libev-dev php8-dev"
checkdepends="php8-pcntl php8-posix"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$_pkgver.tgz"
builddir="$srcdir/$_extname-$_pkgver"

build() {
	phpize8
	./configure --prefix=/usr --with-php-config=/usr/bin/php-config8
	make
}

check() {
	php8 -dextension=modules/$_extname.so --ri $_extname
	local _modules=/usr/lib/php8/modules
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test \
		TESTS=--show-diff \
		PHP_TEST_SHARED_EXTENSIONS=" \
		-d extension=$_modules/pcntl.so \
		-d extension=$_modules/posix.so \
		-d extension=$_modules/sockets.so \
		-d extension=modules/$_extname.so"
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php8/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
2712d00b23a1844c89dee84893032850845033d68a201f4edc704f3bf63c9ce6abb39d940eab62c3a7a4fbee6b7d9c893a7117bd6f0fed9a6953c622ad34bfdc  php-pecl-ev-1.1.6_rc1.tgz
"
